package com.young.test.services;

import java.beans.ConstructorProperties;

import org.apache.log4j.Logger;

import com.young.test.daos.ImportDao1;
import com.young.test.daos.ImportDao2;

public class ConstructorInjectionService {
	/**
	 * Logger for this class
	 */
	private static final Logger logger = Logger.getLogger(ConstructorInjectionService.class);
	
	private ImportDao1 dao1;
	private ImportDao2 dao2;
	private String name;
	private int count;

	public ImportDao1 getDao1() {
		return dao1;
	}

	public ImportDao2 getDao2() {
		return dao2;
	}

	public ConstructorInjectionService(ImportDao1 dao1, ImportDao2 dao2, String name, int count){
		this.dao1 = dao1;
		this.dao2 = dao2;
		this.name = name;
		this.count = count;
		logger.info("ConstructorInjectionService is created");
	}
	
	@ConstructorProperties({"name","count"})
	public ConstructorInjectionService(String name, int count){
		this.name = name;
		this.count = count;
		logger.info("ConstructorInjectionService is created");
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	public void setDao1(ImportDao1 dao1) {
		this.dao1 = dao1;
	}

	public void setDao2(ImportDao2 dao2) {
		this.dao2 = dao2;
	}
	
	public void info(){
		dao1.info();
		logger.info(" It's value is");
		logger.info("first para name is : dao1. value is :"+dao1);
		logger.info("second para name is : dao2. value is :"+dao2);
		logger.info("3th para name is : name. value is :"+name);
		logger.info("4th para name is : count. value is :"+count);
	}
}
